import { User } from '@libs/db/models/User.model';
import { Controller, Get } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { Crud } from 'nestjs-mongoose-crud';
import { InjectModel } from 'nestjs-typegoose';

@Crud({
    model: User
})
@Controller('users')
@ApiTags('用户')
export class UsersController {

    constructor(@InjectModel(User) private readonly model){ }

    @Get('option')
    option() {
        return {
            title: '用户管理',
            border: true,
            searchMenuSpan:8,
            column: [
                { prop: 'username', label: '用户名', search: true, regex: true },
                { prop: 'password', label: '密码', type: 'password' },
            ]
        }
    }
}
